package com.kang.controller;

import com.kang.service.EssayService;
import com.kang.util.WebResponse;
import com.kang.vo.ParamInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = "文章管理端接口")
@RequestMapping("/admin/essay")
@Slf4j
public class EssayController {

    @Autowired
    private EssayService essayService;

    @ApiOperation("分页查询数据")
    @GetMapping("selectPage")
    public WebResponse selectPage(ParamInfo paramInfo) {
        try {
            return WebResponse.resSuccess("分页数据查询成功",essayService.selectPage(paramInfo));
        } catch (Exception ex) {
            log.error("分页查询数据错误",ex);
            return WebResponse.resFail("分页查询数据错误",null);
        }
    }

}
